package com.itheima_01;

import java.util.Iterator;
import java.util.TreeSet;

public class Test01 {
    public static void main(String[] args) {
        TreeSet<Student>  ts = new TreeSet<>();
        Student s1 = new Student("张三",18);
        Student s2 = new Student("李四",15);
        Student s3 = new Student("王五",19);
        Student s4 = new Student("赵六",15);

        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);

       // System.out.println(ts);
        Iterator<Student> iterator = ts.iterator();
        while (iterator.hasNext()){
            Student next = iterator.next();
            System.out.println(next);
        }
    }
}
